package com.census.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Created by WangKai's Hands.
 * User:WangKai
 * Date:2017/6/30
 * Time:2:35
 * Email: 1786025737@qq.com
 */
@Entity
public class Census {
    private int censusId;
    private int censusNum;
    private String holderName;
    private String holderId;
    private int familySize;

    @Id
    @Column(name = "census_id")
    public int getCensusId() {
        return censusId;
    }

    public void setCensusId(int censusId) {
        this.censusId = censusId;
    }

    @Basic
    @Column(name = "census_num")
    public int getCensusNum() {
        return censusNum;
    }

    public void setCensusNum(int censusNum) {
        this.censusNum = censusNum;
    }

    @Basic
    @Column(name = "holder_name")
    public String getHolderName() {
        return holderName;
    }

    public void setHolderName(String holderName) {
        this.holderName = holderName;
    }

    @Basic
    @Column(name = "holder_id")
    public String getHolderId() {
        return holderId;
    }

    public void setHolderId(String holderId) {
        this.holderId = holderId;
    }

    @Basic
    @Column(name = " family_size")
    public int getFamilySize() {
        return familySize;
    }

    public void setFamilySize(int familySize) {
        this.familySize = familySize;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Census census = (Census) o;

        if (censusId != census.censusId) return false;
        if (censusNum != census.censusNum) return false;
        if (familySize != census.familySize) return false;
        if (holderName != null ? !holderName.equals(census.holderName) : census.holderName != null) return false;
        if (holderId != null ? !holderId.equals(census.holderId) : census.holderId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = censusId;
        result = 31 * result + censusNum;
        result = 31 * result + (holderName != null ? holderName.hashCode() : 0);
        result = 31 * result + (holderId != null ? holderId.hashCode() : 0);
        result = 31 * result + familySize;
        return result;
    }
}
